'''
封装解析数据，如解析dict,
'''

import jsonpath


class Decode_dict(dict):
    def __getattr__(self, item):
        value = self.get(item)
        if type(value) == dict:
            value = Decode_dict(value)
            if isinstance(value,list) or isinstance(value,tuple):
                value = list(value)
                for index,list_value in enumerate(value):
                    if isinstance(list_value,dict):
                        value[index] = Decode_dict(list_value)

        return value
